package www.alterzhang.cn.webservice;

import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.HashMap;
import java.util.Map;

/**
 * Created by Administrator on 2018/4/15 0015.
 */
@ControllerAdvice(basePackages={"www.alterzhang.cn.webservice"})
public class GlobalExceptionHandler {

    @ResponseBody
    @ExceptionHandler(RuntimeException.class)
    public Map<String,Object> getMap(){
        Map<String,Object> map=new HashMap<String,Object>();
        map.put("result","error");
        map.put("status","500");
        return map;
    }
}
